package com.sl.au.service.impl;

import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.PageRequest;
import org.springframework.data.domain.Pageable;
import org.springframework.data.domain.Sort;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import com.sl.au.entity.ReceivedPaymentTotalInfo;
import com.sl.au.entity.ReceivedPaymentTotalInfoView;
import com.sl.au.repository.ReceivedPaymentTotalInfoViewRepository;
import com.sl.au.service.ReceivedPaymentTotalInfoViewService;

@Service("ReceivedPaymentTotalInfoViewService")
@Transactional
public class ReceivedPaymentTotalInfoViewServiceImpl extends BaseServiceImpl implements ReceivedPaymentTotalInfoViewService {

	@Autowired
	ReceivedPaymentTotalInfoViewRepository receivedPaymentTotalInfoViewRepository;
	@Override
	public ReceivedPaymentTotalInfoViewRepository getRepository() {
		// TODO Auto-generated method stub
		return this.receivedPaymentTotalInfoViewRepository;
	}
	@Override
	public List<ReceivedPaymentTotalInfoView> getPage(int start, int length, String key) {
		Pageable pageable = new PageRequest(start / length, length, Sort.Direction.ASC, "dReceivedPaymentsDate");
		Page<ReceivedPaymentTotalInfoView> pages = receivedPaymentTotalInfoViewRepository.getPage(key, pageable);
		return pages.getContent();	
	}
	@Override
	public long getCount(String key) {
		long count =receivedPaymentTotalInfoViewRepository.getCount(key);
		return count;
	}
	@Override
	public List<ReceivedPaymentTotalInfoView> getPage1(int start, int length, String key) {
		Pageable pageable = new PageRequest(start / length, length, Sort.Direction.ASC, "dReceivedPaymentsDate");
		Page<ReceivedPaymentTotalInfoView> pages = receivedPaymentTotalInfoViewRepository.getPage1(key, pageable);
		return pages.getContent();	
	}
	@Override
	public long getCount1(String key) {
		long count =receivedPaymentTotalInfoViewRepository.getCount1(key);
		return count;
	}

}
